1. Technical Field
The present invention relates in general to creating programs for data processing systems and in particular to mechanisms relating to creating branch conditions within programs for data processing systems. Still more particularly, the present invention relates to a mechanism for utilizing information regarding a straight path from a branch condition to improve program performance.
2. Description of the Related Art
Most contemporary processors support "pipelining," a method of fetching and decoding instructions (preprocessing) in which, at any given time, several program instructions are in various stages of being fetched or decoded. The goal of pipelining is to assure that the processor never waits for instructions; that is, upon completion of each instruction, the next instruction is ready for execution. This feature also enables a processor to look ahead, prefetching instructions and executing them asynchronously or out of order. For processors with multiple execution units, pipelining allows multiple instructions to be executed each cycle.
When a program's flow branches based on a specific condition, such as a parameter value or a flag setting, typically one of the two paths from the branch is selected and the instructions for that path fetched and decoded. If the program flow takes a non-predicted path, however, the processor must discard the pipeline, losing any pipeline performance gains.
Performance tools are available which provide a determination of which paths from a branch are executed most often. This data may be utilized to improve program performance, but require source code modifications to realize performance gains. The situation is further complicated by the different pipelining mechanisms employed by different commercial processors. For the performance gains to be realized across multiple platforms, additional source code modifications and/or multiple versions of the program are required.
It would be advantageous, therefore, to provide an ability in high level programming languages to inform the compiler when a branch path should be designated as the default or "straight" path. It may also be desirable to provide an ability to inform the compiler when a branch path is less frequently selected than other branch paths. In either case, it would be desirable for the mechanism to promote execution speed and to reduce the executable code size.